package fr.ordre66.vlcs.client;

import java.awt.image.BufferedImage;

import uk.co.caprica.vlcj.player.direct.RenderCallbackAdapter;

public final class RenderCallback extends RenderCallbackAdapter {

	private final BufferedImage image;
	private ImagePane imagePane;
	int width, height;

	public RenderCallback(BufferedImage image, ImagePane imagePane, int width, int height) {
		super(new int[width * height]);
		this.width = width;
		this.height = height;
		this.image = image;
		this.imagePane = imagePane;
	}

	@Override
	public void onDisplay(int[] data) {
		// The image data could be manipulated here...
		image.setRGB(0, 0, width, height, data, 0, width);
		imagePane.repaint();
	}
}
